package cn.ciee.f4.orchard.Enum.util;

import java.util.ArrayList;
import java.util.HashMap;

import android.content.Context;
import android.widget.SimpleAdapter;

import com.ciee.f4.orchard.R;

public class AdapteHelper {

	public SimpleAdapter getMenuAdapter(String[] menuNameArray,
			int[] imageResourceArray, Context context) {
		ArrayList<HashMap<String, Object>> list = new ArrayList<HashMap<String, Object>>();
		for (int i = 0; i < menuNameArray.length; i++) {
			HashMap<String, Object> item = new HashMap<String, Object>();
			item.put("image", imageResourceArray[i]);
			item.put("text", menuNameArray[i]);
			list.add(item);
		}

		SimpleAdapter adapter = new SimpleAdapter(
				context,
				list,
				R.layout.item_menu_main,
				new String[] { "image", "text" },
				new int[] { R.id.menu_main_item_image, R.id.menu_main_item_text });
		return adapter;
	}
}
